package com.tengju.bff.interfaces.covercharge.entity.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.tengju.bff.interfaces.covercharge.constant.LetaxWithdrawStatusEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * <p>
 * 服务费体现周期累计表
 * </p>
 *
 * @author zhaoyi
 * @since 2020-02-24
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("w_service_withdarw_cycle_add")
public class ServiceWithdarwCycleAdd implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 代理id_code
     */
    @TableField("id_code")
    private Integer idCode;

    /**
     * 账号id,service_account表的id
     */
    @TableField("account_id")
    private Integer accountId;

    /**
     * 累计金额
     */
    @TableField("total")
    private BigDecimal total;

    @TableField("ratio")
    private BigDecimal ratio;

    /**
     * 开始时间
     */
    @TableField("start_at")
    private Date startAt;

    /**
     * 结束时间
     */
    @TableField("end_at")
    private Date endAt;

    /**
     * 创建时间
     */
    @TableField("created_at")
    private Date createdAt;

    /**
     * 更新时间戳
     */
    @TableField("updated_at")
    private Date updatedAt;

    /**
     * 打款状态： 0 未打款 2 已打款 5 打款失败
     */
    @TableField("withdraw_status")
    private Integer withdrawStatus;

    /**
     * 打款时间
     */
    @TableField("withdraw_time")
    private Date withdrawTime;

    /**
     * 打款备注
     */
    @TableField("remark")
    private String remark;

    /**
     * 网银流水号
     */
    @TableField("bank_flow")
    private String bankFlow;

    /**
     * 打款渠道
     */
    @TableField("channel")
    private String channel;

    /**
     * 打款人
     */
    @TableField("withdrawer")
    private String withdrawer;


    public void changeStatus(LetaxWithdrawStatusEnum status) {
        this.withdrawStatus = status.getCode();
    }

}
